home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / Game.EXE_01_2001.iso / demos / Blade of Darkness / data1.cab / Program_Executable_Files / Lib / Blood.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-11-16  |  9.0 KB  |  233 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Bladex
  5. import math
  6. import InitDataField
  7. Evaporation = 0
  8. AfterCreateBlood = None
  9.  
  10. def BloodPrtlHit(prtl_name, hit_entity, x, y, z, vx, vy, vz, wcx, wcy, wcz, wdx, wdy, wdz):
  11.     p = Bladex.CreateEntity('BloodPool', 'Entity Pool', x, y, z)
  12.     prtl = Bladex.GetEntity(prtl_name)
  13.     
  14.     try:
  15.         if prtl.Data.evaporation:
  16.             p.DeathTime = Bladex.GetTime() + 20.0
  17.         elif Evaporation:
  18.             p.DeathTime = Bladex.GetTime() + 50.0
  19.     except:
  20.         if Evaporation:
  21.             p.DeathTime = Bladex.GetTime() + 50.0
  22.         
  23.  
  24.     if AfterCreateBlood:
  25.         AfterCreateBlood(x, y, z)
  26.     
  27.  
  28.  
  29. def GreenBloodPrtlHit(prtl_name, hit_entity, x, y, z, vx, vy, vz, wcx, wcy, wcz, wdx, wdy, wdz):
  30.     p = Bladex.CreateEntity('BloodPool', 'Entity Pool', x, y, z)
  31.     p.Color = (96, 192, 96)
  32.     p.DeepColor = (64, 128, 64)
  33.     if Evaporation:
  34.         p.DeathTime = Bladex.GetTime() + 50.0
  35.     
  36.     smoke = Bladex.CreateEntity('FuegoVerde', 'Entity Particle System D1', x, y, z)
  37.     smoke.ParticleType = 'VenomSmoke'
  38.     smoke.YGravity = -100.0
  39.     smoke.Friction = 0.05
  40.     smoke.PPS = 8
  41.     smoke.Velocity = (0.0, -800.0, 0.0)
  42.     smoke.RandomVelocity = 5.0
  43.     smoke.DeathTime = Bladex.GetTime() + 1.5
  44.  
  45.  
  46. def GreyBloodPrtlHit(prtl_name, hit_entity, x, y, z, vx, vy, vz, wcx, wcy, wcz, wdx, wdy, wdz):
  47.     p = Bladex.CreateEntity('BloodPool', 'Entity Pool', x, y, z)
  48.     p.Color = (96, 96, 96)
  49.     p.DeepColor = (80, 80, 80)
  50.     if Evaporation:
  51.         p.DeathTime = Bladex.GetTime() + 50.0
  52.     
  53.  
  54.  
  55. def BleedFunc(blood_name, end_time, period):
  56.     blood = Bladex.GetEntity(blood_name)
  57.     if blood:
  58.         prtl = blood.GetParticleEntity()
  59.         InitDataField.Initialise(prtl)
  60.         prtl.Data.evaporation = 0
  61.         if blood.ParticleType == 'GreenBlood':
  62.             prtl.HitFunc = GreenBloodPrtlHit
  63.         elif blood.ParticleType == 'GreyBlood':
  64.             prtl.HitFunc = GreyBloodPrtlHit
  65.         else:
  66.             prtl.HitFunc = BloodPrtlHit
  67.         if Bladex.GetTime() < end_time:
  68.             Bladex.AddScheduledFunc(Bladex.GetTime() + period, BleedFunc, (blood_name, end_time, period), blood.Name + ' BleedFunc')
  69.         
  70.     
  71.  
  72. AGE_Number = 0
  73.  
  74. def Bleed(objname, start_time, end_time, period, x = 0.0, y = 0.0, z = 0.0, vx = 0, vy = 0, vz = 0, ParticleType = 'Blood'):
  75.     global AGE_Number
  76.     AGE_Number = AGE_Number + 1
  77.     blood = Bladex.CreateEntity('bleed_AGE_' + str(AGE_Number), 'Entity Particle System D1', x, y, z)
  78.     blood.ParticleType = ParticleType
  79.     blood.YGravity = 9800.0
  80.     blood.Friction = 0.075
  81.     blood.PPS = 512
  82.     blood.DeathTime = end_time + 1.0 / 60.0
  83.     blood.Velocity = (vx, vy, vz)
  84.     Bladex.GetEntity(objname).Link(blood)
  85.     Bladex.AddScheduledFunc(start_time, BleedFunc, (blood.Name, end_time, period), blood.Name + ' BleedFunc')
  86.  
  87.  
  88. def PersonBleed(per, start_time, end_time, period, x = 0.0, y = 0.0, z = 0.0, vx = 0, vy = 0, vz = 0, node = 0):
  89.     global AGE_Number
  90.     if node < 0:
  91.         print 'invalid node'
  92.         return None
  93.     
  94.     AGE_Number = AGE_Number + 1
  95.     blood = Bladex.CreateEntity('bleed_AGE_' + str(AGE_Number), 'Entity Particle System D1', x, y, z)
  96.     if per.Kind == 'Spidersmall':
  97.         blood.ParticleType = 'GreenBlood'
  98.     elif per.Kind == 'Lich':
  99.         blood.ParticleType = 'GreyBlood'
  100.     else:
  101.         blood.ParticleType = 'Blood'
  102.     blood.YGravity = 9800.0
  103.     blood.Friction = 0.075
  104.     blood.PPS = 512
  105.     blood.DeathTime = end_time + 1.0 / 60.0
  106.     blood.Velocity = (vx, vy, vz)
  107.     per.LinkToNode(blood, node)
  108.     Bladex.AddScheduledFunc(start_time, BleedFunc, (blood.Name, end_time, period), blood.Name + ' BleedFunc')
  109.  
  110. SparkEntities = [
  111.     'Golem_metal',
  112.     'ChaosKnight']
  113. DustDeathEntities = [
  114.     'Skeleton',
  115.     'Lich',
  116.     'Golem_stone',
  117.     'Golem_clay',
  118.     'Golem_lava',
  119.     'Knight_Zombie'] + SparkEntities
  120.  
  121. def Mutilate(pj_name, obj_name, x, y, z, nx, ny, nz, node):
  122.     vx = nx * 2000.0
  123.     vy = ny * 2000.0
  124.     vz = nz * 2000.0
  125.     per = Bladex.GetEntity(pj_name)
  126.     if per.Kind in DustDeathEntities:
  127.         return None
  128.     
  129.     if per.Kind == 'Spidersmall':
  130.         Bleed(obj_name, Bladex.GetTime() + 0.0, Bladex.GetTime() + 1.0, 0.2, x, y, z, vx, vy, vz, 'GreenBlood')
  131.     elif per.Kind == 'Lich':
  132.         Bleed(obj_name, Bladex.GetTime() + 0.0, Bladex.GetTime() + 1.0, 0.2, x, y, z, vx, vy, vz, 'GreyBlood')
  133.     else:
  134.         Bleed(obj_name, Bladex.GetTime() + 0.0, Bladex.GetTime() + 1.0, 0.2, x, y, z, vx, vy, vz)
  135.     (x, y, z) = Bladex.GetEntity(obj_name).Rel2AbsPoint(x, y, z)
  136.     PersonBleed(per, Bladex.GetTime() + 0.0, Bladex.GetTime() + 1.5, 0.125, x, y, z, -2.0 * vx, -2.0 * vy, -2.0 * vz, node)
  137.  
  138.  
  139. def BleedingImpact(entity, x, y, z, ImpX, ImpY, ImpZ, weapon_entity, WeaponCx, WeaponCy, WeaponCz, WeaponDx, WeaponDy, WeaponDz):
  140.     global AGE_Number
  141.     AGE_Number = AGE_Number + 1
  142.     if entity.Kind in DustDeathEntities:
  143.         dust = Bladex.CreateEntity('dust_AGE_' + str(AGE_Number), 'Entity Particle System D1', x, y, z)
  144.         if entity.Kind == 'Golem_clay':
  145.             dust.ParticleType = 'ShitSmoke'
  146.             dust.Time2Live = 63
  147.             dust.PPS = 60
  148.             dust.RandomVelocity = 30.0
  149.         elif entity.Kind == 'Golem_lava':
  150.             dust.ParticleType = 'LargeFire'
  151.             dust.Time2Live = 31
  152.             dust.PPS = 60
  153.             dust.RandomVelocity = 30.0
  154.         elif entity.Kind in SparkEntities:
  155.             dust.ParticleType = 'Splinter'
  156.             dust.Time2Live = 16
  157.             dust.PPS = 128
  158.             dust.RandomVelocity = 50.0
  159.         else:
  160.             dust.ParticleType = 'MediumDust'
  161.             dust.Time2Live = 63
  162.             dust.PPS = 60
  163.             dust.RandomVelocity = 30.0
  164.         dust.YGravity = 0.0
  165.         dust.Friction = 0.1
  166.         dust.Velocity = (0.0, 0.0, 0.0)
  167.         dust.DeathTime = Bladex.GetTime() + 4.0 / 60.0
  168.     else:
  169.         time = Bladex.GetTime()
  170.         if weapon_entity:
  171.             stickblood = Bladex.CreateEntity('stickbleed_AGE_' + str(AGE_Number), 'Entity Particle System D2', WeaponCx, WeaponCy, WeaponCz)
  172.             stickblood.D = (WeaponDx, WeaponDy, WeaponDz)
  173.             stickblood.YGravity = 9800.0
  174.             stickblood.Friction = 0.15
  175.             stickblood.Friction2 = 0.0
  176.             stickblood.DeathTime = time + 0.4
  177.             stickblood.RandomVelocity = 100.0 / 60
  178.             stickblood.RandomVelocity_V = 100.0 / 60
  179.             stickblood.Time2Live = 26.0
  180.             stickblood.Time2Live_V = 6.0
  181.             stickblood.PPS = 600
  182.             weapon_entity.Link(stickblood)
  183.         else:
  184.             stickblood = None
  185.         blood = Bladex.CreateEntity('bleed_AGE_' + str(AGE_Number), 'Entity Particle System D1', x, y, z)
  186.         blood.YGravity = 9800.0
  187.         blood.Friction = 0.075
  188.         blood.PPS = 600
  189.         blood.DeathTime = time + 10.0 / 60.0
  190.         blood.Position = (x, y, z)
  191.         scale = math.sqrt(ImpX * ImpX + ImpY * ImpY + ImpZ * ImpZ)
  192.         if scale == 0.0:
  193.             scale = 1.0
  194.         
  195.         scale = -2000.0 / scale
  196.         blood.Velocity = (ImpX * scale, ImpY * scale - 2000.0, ImpZ * scale)
  197.         blood.RandomVelocity = 15.0
  198.         blood.RandomVelocity_V = 10.0
  199.         blood.Time2Live = 32
  200.         if stickblood:
  201.             prtl1 = stickblood.GetParticleEntity()
  202.             InitDataField.Initialise(prtl1)
  203.             prtl1.Data.evaporation = 1
  204.         else:
  205.             prtl1 = blood.GetParticleEntity()
  206.             InitDataField.Initialise(prtl1)
  207.             prtl1.Data.evaporation = 1
  208.         prtl2 = blood.GetParticleEntity()
  209.         InitDataField.Initialise(prtl2)
  210.         prtl2.Data.evaporation = 1
  211.         if entity.Kind == 'Spidersmall':
  212.             blood.ParticleType = 'GreenBlood'
  213.             if stickblood:
  214.                 stickblood.ParticleType = 'GreenBlood'
  215.             
  216.             prtl1.HitFunc = GreenBloodPrtlHit
  217.             prtl2.HitFunc = GreenBloodPrtlHit
  218.         elif entity.Kind == 'Lich':
  219.             blood.ParticleType = 'GreyBlood'
  220.             if stickblood:
  221.                 stickblood.ParticleType = 'GreyBlood'
  222.             
  223.             prtl1.HitFunc = GreyBloodPrtlHit
  224.             prtl2.HitFunc = GreyBloodPrtlHit
  225.         else:
  226.             blood.ParticleType = 'Blood'
  227.             if stickblood:
  228.                 stickblood.ParticleType = 'Blood'
  229.             
  230.             prtl1.HitFunc = BloodPrtlHit
  231.             prtl2.HitFunc = BloodPrtlHit
  232.  
  233.